﻿
/*========================================================================================
// -- 
//创建者: goodasong
//创建时间：2011年9月23日 星期五
//类描述：实体类 TFunction (属性说明自动提取数据库字段的描述信息)
//最后修改者:goodasong
//最后修改时间:2011年9月23日 星期五	
=========================================================================================*/
using System;
using System.Web;
using System.Runtime.Serialization;

namespace COM.Rights.Model
{
    [Serializable]
    [Model(Name = "TFunction", PrimaryKey = "GID", ModelType = ModelType.Table, Condition = "1=1", IsNeedRecordModify = true)]
    public partial class TFunctionInfo : BaseModel
    {
        public TFunctionInfo()
        {
            PrimaryKey = "GID";
            Fields.Add("GID");//主键
            Fields.Add("ID");//标识
            Fields.Add("PGID");//上级结点
            Fields.Add("Name");//名称
            Fields.Add("EName");//英文名称
            Fields.Add("Code");//编码
            Fields.Add("FType");//类型
            Fields.Add("URI");//URI
            Fields.Add("Sequence");//序号


            CanNotNullFields.Add("GID");//主键不能为空!				


            CanNotNullFields.Add("PGID");//上级结点不能为空!				

            CanNotNullFields.Add("Name");//名称不能为空!				

            //CanNotNullFields.Add("EName");//英文名称不能为空!				

            CanNotNullFields.Add("Code");//编码不能为空!				

            CanNotNullFields.Add("FType");//类型不能为空!				
            this.OnCreated();
            this.OnModelCreated();
        }
        public TFunctionInfo(bool isNewInfo)
            : this()
        {
            IsNew = isNewInfo;
        }
        #region 方法

        public void OnCreated() { this.SetPrimaryKeyValue(); }

        public override void SetPrimaryKeyValue()
        {
            GID = Guid.NewGuid().ToString();
        }
        #endregion

        #region 成员变量

        private string _GID;//主键
        private int? _ID;//标识
        private string _PGID;//上级结点
        private string _Name;//名称
        private string _EName;//英文名称
        private string _Code;//编码
        private int? _FType;//类型
        private string _URI;//URI
        private int? _Sequence;//序号

        #endregion

        #region 属性

        /// <summary>
        /// 主键
        /// </summary>       
        [ModelField(Description = "主键", Type = typeof(string), ErrorMessage = "主键信息错误!", FieldType = FieldType.Normal, IsKeyField = true, IsUnique = true, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 36, DbType = "char", IsNeedRecordModify = true)]
        public virtual string GID
        {
            get
            {
                return this._GID;
            }
            set
            {
                if (_GID != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "GID", _GID, value, "char", "主键");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnGIDChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._GID = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnGIDChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _GID = value;
                    }
                }
            }
        }

        /// <summary>
        /// 标识
        /// </summary>       
        [ModelField(Description = "标识", Type = typeof(int?), ErrorMessage = "标识信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 4, DbType = "int", IsNeedRecordModify = true)]
        public virtual int? ID
        {
            get
            {
                return this._ID;
            }
            set
            {
                _ID = value;
            }
        }

        /// <summary>
        /// 上级结点
        /// </summary>       
        [ModelField(Description = "上级结点", Type = typeof(string), ErrorMessage = "上级结点信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 36, DbType = "varchar", IsNeedRecordModify = true)]
        public virtual string PGID
        {
            get
            {
                return this._PGID;
            }
            set
            {
                if (_PGID != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "PGID", _PGID, value, "varchar", "上级结点");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnPGIDChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._PGID = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnPGIDChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _PGID = value;
                    }
                }
            }
        }

        /// <summary>
        /// 名称
        /// </summary>       
        [ModelField(Description = "名称", Type = typeof(string), ErrorMessage = "名称信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 50, DbType = "nvarchar", IsNeedRecordModify = true)]
        public virtual string Name
        {
            get
            {
                return this._Name;
            }
            set
            {
                if (_Name != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "Name", _Name, value, "nvarchar", "名称");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnNameChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._Name = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnNameChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _Name = value;
                    }
                }
            }
        }

        /// <summary>
        /// 英文名称
        /// </summary>       
        [ModelField(Description = "英文名称", Type = typeof(string), ErrorMessage = "英文名称信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 50, DbType = "varchar", IsNeedRecordModify = true)]
        public virtual string EName
        {
            get
            {
                return this._EName;
            }
            set
            {
                if (_EName != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "EName", _EName, value, "varchar", "英文名称");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnENameChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._EName = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnENameChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _EName = value;
                    }
                }
            }
        }

        /// <summary>
        /// 编码
        /// </summary>       
        [ModelField(Description = "编码", Type = typeof(string), ErrorMessage = "编码信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 100, DbType = "varchar", IsNeedRecordModify = true)]
        public virtual string Code
        {
            get
            {
                return this._Code;
            }
            set
            {
                if (_Code != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "Code", _Code, value, "varchar", "编码");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnCodeChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._Code = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnCodeChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _Code = value;
                    }
                }
            }
        }

        /// <summary>
        /// 类型
        /// </summary>       
        [ModelField(Description = "类型", Type = typeof(int?), ErrorMessage = "类型信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = false, IsDbGenerated = false, Size = 4, DbType = "int", IsNeedRecordModify = true)]
        public virtual int? FType
        {
            get
            {
                return this._FType;
            }
            set
            {
                if (_FType != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "FType", _FType, value, "int", "类型");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnFTypeChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._FType = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnFTypeChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _FType = value;
                    }
                }
            }
        }

        /// <summary>
        /// URI
        /// </summary>       
        [ModelField(Description = "URI", Type = typeof(string), ErrorMessage = "URI信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = true, IsDbGenerated = false, Size = 1000, DbType = "nvarchar", IsNeedRecordModify = true)]
        public virtual string URI
        {
            get
            {
                return this._URI;
            }
            set
            {
                if (_URI != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "URI", _URI, value, "nvarchar", "URI");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnURIChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._URI = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnURIChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _URI = value;
                    }
                }
            }
        }

        /// <summary>
        /// 序号
        /// </summary>       
        [ModelField(Description = "序号", Type = typeof(int?), ErrorMessage = "序号信息错误!", FieldType = FieldType.Normal, IsKeyField = false, IsUnique = false, IsForeignKey = false, IsAllowNull = true, IsDbGenerated = false, Size = 4, DbType = "int", IsNeedRecordModify = true)]
        public virtual int? Sequence
        {
            get
            {
                return this._Sequence;
            }
            set
            {
                if (_Sequence != value)
                {
                    if (!IsGetDataFromDB)
                    {
                        ModifyInfo modifyInfo = new ModifyInfo("TFunction", "Sequence", _Sequence, value, "int", "序号");
                        this.OnPropertyChanging(modifyInfo);
                        this.OnSequenceChanging(modifyInfo);
                        this.SendPropertyChanging(modifyInfo);

                        this._Sequence = value;

                        this.OnPropertyChanged(modifyInfo);
                        this.OnSequenceChanged(modifyInfo);
                        this.SendPropertyChanged(modifyInfo);
                    }
                    else
                    {
                        _Sequence = value;
                    }
                }
            }
        }
        #endregion 属性

        #region 属性更改事件

        partial void OnGIDChanging(ModifyInfo modifyInfo);//主键GID改变之前发生
        partial void OnGIDChanged(ModifyInfo modifyInfo);//主键GID改变之后发生
        partial void OnIDChanging(ModifyInfo modifyInfo);//标识ID改变之前发生
        partial void OnIDChanged(ModifyInfo modifyInfo);//标识ID改变之后发生
        partial void OnPGIDChanging(ModifyInfo modifyInfo);//上级结点PGID改变之前发生
        partial void OnPGIDChanged(ModifyInfo modifyInfo);//上级结点PGID改变之后发生
        partial void OnNameChanging(ModifyInfo modifyInfo);//名称Name改变之前发生
        partial void OnNameChanged(ModifyInfo modifyInfo);//名称Name改变之后发生
        partial void OnENameChanging(ModifyInfo modifyInfo);//英文名称EName改变之前发生
        partial void OnENameChanged(ModifyInfo modifyInfo);//英文名称EName改变之后发生
        partial void OnCodeChanging(ModifyInfo modifyInfo);//编码Code改变之前发生
        partial void OnCodeChanged(ModifyInfo modifyInfo);//编码Code改变之后发生
        partial void OnFTypeChanging(ModifyInfo modifyInfo);//类型FType改变之前发生
        partial void OnFTypeChanged(ModifyInfo modifyInfo);//类型FType改变之后发生
        partial void OnURIChanging(ModifyInfo modifyInfo);//URIURI改变之前发生
        partial void OnURIChanged(ModifyInfo modifyInfo);//URIURI改变之后发生
        partial void OnSequenceChanging(ModifyInfo modifyInfo);//序号Sequence改变之前发生
        partial void OnSequenceChanged(ModifyInfo modifyInfo);//序号Sequence改变之后发生

        #endregion

        public virtual string DetailURI { get; set; }
        public virtual string DetailHTMLURI { get; set; }
        public virtual string ManageEditURI { get; set; }
        public virtual string ManageDetailURI { get; set; }

        public override void OnLoaded()
        {
            base.OnLoaded();
            DetailURI = ZModel.InitDetailURI("TFunction", "GID", GID);
            DetailHTMLURI = ZModel.InitDetailHTMLURI("TFunction", "GID", GID);
            ManageEditURI = ZModel.InitMEditURI("TFunction", "GID", GID);
            ManageDetailURI = ZModel.InitMDetailURI("TFunction", "GID", GID);
            OnModelLoaded();
        }

        partial void OnModelCreated();
        partial void OnModelLoaded();
    }
}